<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display"%>
<%@ taglib prefix="sx" uri="/struts-dojo-tags"%>

<%@ taglib uri="/WEB-INF/hexacta.tld" prefix="hexacta"%>

<head>
	<sx:head cache="true" />
	<link rel="stylesheet" href="/hrs-intranet/styles/errortag.css" type="text/css" />
	<link rel="stylesheet" href="/hrs-intranet/styles/TabContainerLocal.css" type="text/css" />
	<link rel="stylesheet" href="/hrs-intranet/styles/displaytag.css" type="text/css" />
	<link rel="stylesheet" type="text/css" href="/hrs-intranet/styles/jsgantt.css" />
</head>

<s:include value="errorsSection.jsp"></s:include>

<script type="text/javascript">
	var checkBox = document.getElementById("checkId");
	checkBox.onclick = showConfirmDialog;
 	
	function showConfirmDialog(){
		
			if(confirm("This seniority level has open feedbacks. Are you sure you want to close it anyway?")){
				return true;
			}else {
				return false;
			}
		
	}
	
</script>

<s:form cssClass="formClass">
	<s:textfield name="periodId" label="Period" readonly="true" />
</s:form>

<s:form name = "roleList" >
	<s:a href="FeedbackPeriodsAction" cssClass="Add" cssStyle="position:relative; left:1000px">Return</s:a>
<display:table id="feedbackPeriodResumeByRolesList"
	name="feedbackPeriodResumeByRolesList" defaultsort="1"
	defaultorder="ascending"
	class="listable" cellpadding="0" cellspacing="0"
	pagesize="40">
	<display:column property="function" title="Description" sortable="false" />
	<display:column  title="Finalized" sortable="false" >
		<s:checkbox id="checkId" theme="simple" name="checked" fieldValue="%{#attr.feedbackPeriodResumeByRolesList.code}" value="%{#attr.feedbackPeriodResumeByRolesList.closed}"  onclick="if ((%{#attr.feedbackPeriodResumeByRolesList.numberOfIncompleteFeedbacks}>0) && !%{#attr.feedbackPeriodResumeByRolesList.closed}){ return showConfirmDialog()}" />
	</display:column>

	<!-- !%{#attr.feedbackPeriodRoleList.closed} -->
</display:table>

	<s:hidden name="periodId" >
		<s:param name="periodId">
			<s:property value="periodId"/>
		</s:param>
	</s:hidden>
	<table width="100%">
 		 <tr>
 		 <s:if test="%{!checkForOpenedPeriod()}">
 		 <td width="60" align="right"><table><s:submit action="ManageFeedbacksRolesAction_openAndClosePeriod" value="Open/Close" cssClass="btnLarge" id="okbtn" style="text-align: center"/></table></td>
		 <td width="40" align="left"><table><s:submit action="ManageFeedbacksRolesAction_closeAllPeriods" value="Open/Close All" cssClass="btnLarge" id="okbtn" style="text-align: center"/></table></td>
 		 </s:if ><s:else>
 		 <td width="60" align="center"><table><s:a cssClass="Add" href="FeedbackPeriodsAction" >Another period is open.</s:a> </table></td>
 		 </s:else>
  		</tr>
	</table>


</s:form>		